//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "adminActions\fn_teleportMode.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

if (GVAR(TeleportMode)) then {
	[QGVAR(TeleportMode_EVT_ID), "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
	hint localize "STR_MSO_AA_TELEPORT_MODE_OFF";
} else {
	[QGVAR(TeleportMode_EVT_ID), "onMapSingleClick", { 
		TRACE_1("Start",_this); 
		if (!dialog) then {
			TRACE_1("Pos",_pos);
			_pos set [2,0.1];
			(vehicle player) setpos _pos;
			[QGVAR(LOG),["Teleported",name player, getPlayerUID player, GVAR(TeleportMode), _pos]] call FUNC(raiseEvent);
		};
		TRACE("End");
	}] call BIS_fnc_addStackedEventHandler;
	hint localize "STR_MSO_AA_TELEPORT_MODE_ON";
};
GVAR(TeleportMode) = !GVAR(TeleportMode);

TRACE_1("End",GVAR(TeleportMode));
TMFPROFILERSTOP;
